<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Author" content="cjw">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>用户浏览</title>
  <link type="text/css" rel="stylesheet" href="../css/MyCss.css" />
  <link rel="stylesheet" type="text/css" href="../css/ShopCartStyle.css" />
  <link type="text/css" rel="stylesheet" href="../css/right-bar.css" />
  <link type="text/css" rel="stylesheet" href="../css/base.css" />
  <style>
	*{margin: 0; padding: 0; font-size:12px;}
	.body-con {width:1100px; margin:auto;}

	.goods-nav-con .search{float:right; margin-right:40px;}
	.goods-nav-con .search input[type="text"]{width:260px; height:32px; font-size:14px; border:1px solid #ccc; border-radius:5px; outline:none; padding-left:5px;}
	.goods-nav-con .search input[type="text"]:hover{box-shadow:0px 0px 10px 0px #ccc;}
	.goods-nav-con .search input[type="button"]{width:100px; height:35px; color:white; background-color:#cc0000; border:1px solid #ccc; border-radius:5px; font-size:14px; outline:none;}
	.goods-nav-con .search input[type="button"]:hover{box-shadow:0px 0px 10px 0px #ccc; cursor:pointer;}

	/* S - goods-nav */
	.storp_ico i{background:url("../image/merchant/shop_title.jpg"); width: 260px;height: 91px;display:block;position:inherit;margin:auto;}
	/* E - goods-nav */

	/* S - goods-body */
	.goods-body {}
	.goods-body .body-con {border:1px solid rgba(204, 207, 208, 0.26); margin-top:30px; min-height:628px; overflow: hidden;}
	.body-con ul li {width:; height:; border:1px solid rgba(204, 207, 208, 0.26);}

	#con_body_ul{padding:10px;}
	#con_body_ul li{width:211px; height:270px; border: 1px solid rgba(204, 207, 208, 0.26); list-style-type:none; float:left; overflow:hidden; padding:4px; margin-left:38px; margin-top:20px; color: #555;}
	#con_body_ul li:hover{box-shadow: 0px 0px 10px -1px #adaba6; cursor:pointer;}
		
	#con_body_ul li div:nth-child(1){height:230px;}
	#con_body_ul li div:nth-child(2){text-align:center; height:23px;}
	#con_body_ul li div:nth-child(2) span{font-size: 14px; font-family: sans-serif; margin-left: 2px;}

	#con_body_ul li div:nth-child(3){text-align:center; height:25px;}
	#con_body_ul li div:nth-child(3) span{font-size: 14px; line-height:16px; }

	#con_body_ul li div:nth-child(4) a{width:211px;height:30px;display:block; color: #fff; background:#f90;text-align:center; line-height:30px;cursor:pointer;border-radius:5px;}
	#con_body_ul li div:nth-child(4) a:hover{background:#ec8d00;}
	/* E - goods-body */
  </style>
 </head>
 <body>
	<!--S - infor-nav-->
	<div class="infor-nav">
		<div class="infor-nav-con">
			<!--登录 注册 我的订单 我的个人信息 购物车 -->
			<ul class="nolist">
				<li>
					<label class="loginText">您当前还未登录</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label class="register-bt">注册</label>
				</li>
				<li></li>
				<li></li>
				<li>
					<label class="my-infor">我的信息</label>&nbsp;&nbsp;
					<label class="my-order">我的订单</label>&nbsp;&nbsp;
					<label class="my-cart">购物车</label>
				</li>
			</ul>
		</div>
	</div>
	<!--E - infor-nav-->

	<!--S - follow-box-->
	<div class="follow-box"></div>
	<!--E - follow-box-->

	<!--S - goods-nav-->
	<div class="goods-nav">
		<div class="goods-nav-con">
			<div class="shop-icon">
				<a href="../index.html"></a>
			</div>
			<div class="shop-nav">
				
			</div>
			<!--查找-->
			<div class="search" id="search">
				<input type="text" placeholder="请输入要商品关键字" id="search_text">
				<input type="button" value="搜索本站" id="search_button">
				<!--搜索结果显示区-->
				<div class="search_show" id="search_show"></div>
			</div>
		</div>
		<div class="storp_ico">
			<i></i>
			<div style="clear:both;"></div>
		</div>
	</div>
	<!--E - goods-nav-->

	<!--S - goods-body-->
	<div class="goods-body">
		<div class="body-con">
			<ul id="con_body_ul" class="nolist">
			</ul>
		</div>
	</div>
	<!--E - goods-body-->

	<!--S -  foot-->
	<div class="foot">
		<div class="bom_container">
			<li style="color:#586069;list-style:none;padding:10px 245px;">Copyright ©2017 <span  style="color:#a71d5d;cursor:pointer;" title="作者介绍">chen</span> Powered By <span  style="color:#a71d5d;cursor:pointer;" title="程序目录">shop</span> Version 1.0.0</li>
		</div>
	</div>
	<!--E - foot-->

	<!-- start shop car -->
	<!-- 这里用到的模态框的技术 -->
	<div class="shopcar">
		<div class="shopcarcnt">
			<!-- shopcarclick 收进、出按钮 -->
			<div class="shopcarclick" id="shopcarclick">
				<ul class="nolist click-cnt">
					<!--<i class="shopclick_ico"></i><i class="p-infor"></i><i class="goods-colle"></i><i class="my-food"></i>-->
					<li class="clicknav my-infor-li" title="会员">
						<img src="../image/p_infor.png" width="25px" height="25px" alt=""/>
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						<!--
						未登录
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>您未登录</label>
							</div>
						</div>
						<div class="bar-login">
							<div class="bar-in-com">
								<label>
									<div class="head-pi">
										<img src="image/test/tako.jpg" width="50px" height="50px" />
									</div>
									<div class="menber-name">
										<label>大购物狂</label>
										<label>
											<img title="蓝砖会员" src="image/person/Member3.png" width="20px" height="20px" />
										</label>
									</div>
									<div class="menber-integral">
										积分:25
									</div>
								</label>
							</div>
						</div>
						-->
						
					</li>
					<li class="clicknav car-bt-li" title="购物车">
						<img src="../image/car2.png" width="24px" height="24px" alt=""/>
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						<!--

						未登录
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						-->
					</li>
					<li class="clicknav colle-bt-li" title="商品收藏">
						<img src="../image/colle1.png" width="25px" height="25px" alt=""/>
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						<!--未登录
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						-->
						<!--
						收藏为空
						<div class="bar-login bar-login-null">
							<div class="bar-in-com-nologin">
								<label>空的哦</label>
							</div>
						</div>
						<div class="bar-login">
							<div class="bar-in-com">
							</div>
							<div class="bar-in-bom">
								<label>查看更多收藏</label>
							</div>
						</div>
						<div class="bar-login bar-login-null">
							<div class="bar-in-com-nologin">
								<label>空的哦</label>
							</div>
						</div>
						-->
						
					</li>
					<li class="clicknav foot-bt-li" title="个人足迹">
						<img src="../image/food.png" width="25px" height="25px" alt=""/>
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						<!--
						未登录
						<div class="bar-nologin">
							<div class="bar-in-com-nologin">
								<label>未登录哦</label>
							</div>
						</div>
						<div class="bar-login">
							<div class="bar-in-com">
								<ul class="nolist">
									<li>
										<div class="lictn" data-id="">
											<label class="goodspho">
												<img src='image/test/tako.jpg' width="55" height="60" />
											</label>
											<label class="colledes">
												<label class="colle-infor">
													<label class="colle-name">黑白条纹打底衫</label>
													<label class="colle-price"><del>110</del>120</label>
												</label>
											</label>
										</div>
									</li>
								</ul>
							</div>
							<div class="bar-in-bom">
								<label>查看更多</label>
							</div>
						</div>
						-->
						
					</li>
				</ul>
			</div>
			

			<!-- list_cont -->
			<div class="list_cont">
				<!-- shopping_head 标题 -->
				<div class="shopping_head">购物车</div>

				<!-- shopping_list 购物清单 -->
				<div class="shopping_list">
					<div class="shop_list_cnt">
						<!-- 单个物品 -->	
						<ul class="nolist">
						</ul>
					</div>
				</div>
				<!-- shopping_result 结算结果 -->
				<div class="shopping_result">
					<div class="RMB_result">
						<span>合计</span>
						<span class="RMB_NUM">0</span>
						<span>元</span>
					</div>
					<div class="result_button">
						<input type="button" value="结算" />
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- shop car end -->
	<script src="../js/MyjsV0-8.js"></script>
	<script src="../js/shop_cart.js"></script>
	<script src="../js/util-2.js"></script>
	<script>
	//点击前往管理页
	$(".my-infor")[0].onclick = function(){
		
	}
	
	
	/* S-goods-body */
	//点击前往商品页
	$("#con_body_ul").onclick = function(e){
		console.log("商品点击 " + e.target.tName());
		if(e.target.tName() == "img"){
			var id = e.target.parent("li").attr("data-id");
			//传递的参数为所点击商品的id
			/**/
			ajax({
				type:"post",
				url:"member_linkToGoods",
				data:{data:id}, 
				success:function(msg){
					window.open('../fonts/商品页.html');
				},
				error:function(){
					alert("服务器异常，无法处理跳转。。。。");
				}
			});
			
			window.open('../fonts/商品页.html');
			console.log("跳转id为 - "+e.target.parent("li").attr("data-id"));
		}
	}

	/*
	测试数据
	var goods = new goodsMudle(); //商品模板
	for(var i = 0; i < merchantData.length(); i++){
		var mgoods = merchantData.getJSONObject(i);
		var item = getGoodsItemById(mgoods.get("id"));
		$("#con_body_ul").insert(goods.makeHTML(item.get("id"), "../"+item.get("img"), item.get("price"), item.get("name")));
	}
	*/
	//初始化页面
	/**/
	ajax({
		type:"post",
		url:"merchantIndexAction",
		success:function(msg){
			if(isJSON(msg)){
				var goodss = Tokener.parseObject(msg);
				var it = goodss.itarator();
				while(it.hasNext()){
					var object = it.next();
					$("#con_body_ul").insert(goods.makeHTML(object.get("id"), "../"+object.get("imgPath"), object.get("price"), object.get("name")));
				}
			}else alert("初始化数据异常");
		},
		error:function(msg){
			alert("初始化异常");
		}
	});
	

	//测试数据

	//商品模板
	function goodsMudle(){
		//html累加
		this.makeHTML = function (id,p_url,price,goodN,alt){
			return "<li data-id='"+id+"'>" +
							"<div>" +
								"<img src="+p_url+" title='点击跳转到商品页' alt='"+alt+"' width='211px' height='230px'/>" +
							"</div>" +
							"<div>" +
								"<span>"+price+"</span>" +
							"</div>" +
							"<div>" +
								"<span>"+goodN+"</span>" +
							"</div>" +
						"</li>";
		}
	}

	/* E-goods-body */

	//初始化右栏
	/*
	测试数据
	var privili = true;
	//登录成功 添加容器  收藏 足迹
	$(".colle-bt-li")[0].insert(cntMudle("colle-cnt"));
	if(colls != null){
		for(var i = 0; i < colls.length(); i++){
			var coll = colls.getJSONObject(i);
			var item = getGoodsItemById(coll.get("id"));
			if(item != null){
				$(".colle-cnt")[0].insert(createFoot(item.get("id"), "../"+item.get("img"), item.get("name")));
			}else{
				console.log("err:"+coll.get("id"));
			}
			
		}
	}

	$(".foot-bt-li")[0].insert(cntMudle("foot-cnt"));
	if(foots != null){
		for(var i = 0; i < foots.length(); i++){
			var foot = foots.getJSONObject(i);
			var item = getGoodsItemById(foot.get("id"));
			if(item != null){
				$(".foot-cnt")[0].insert(createFoot(item.get("id"), "../"+item.get("img"), item.get("name")));
			}else{
				console.log("err:"+foot.get("id"));
			}
		}
	}
	
	if(cars != null){
		var rmb = 0;
		for(var i = 0; i < cars.length(); i++){
			var car = cars.getJSONObject(i);
			var item = getGoodsItemById(car.get("id"));
			if(item != null){
				$(".shop_list_cnt")[0].$("ul")[0].insert(createCar(item.get("id"), "../"+item.get("img"), item.get("name"), car.get("size"), car.get("count"), item.get("price")));
				rmb += car.get("count")*item.get("price");
			}else{
				console.log("err:"+car.get("id"));
			}
		}
		$(".RMB_NUM")[0].text(rmb);
	}

	$(".my-infor-li")[0].insert(createInfor_login("../image/person/tako.jpg", "xxxxx", 120));
	*/
	/**/
	var privili = false;
	ajax({
		type:"post",
		url:"initIndex",
		success:function(msg){
			if(isJSON(msg)){
				var es = $(".bar-nologin");
				for(var i = 0; i < es.length; i ++){
					se[i].remove();
				}
				privili = true;
				//登录成功 添加容器  收藏 足迹
				$(".colle-bt-li")[0].insert(createCnt("colle-cnt"));
				$(".foot-bt-li")[0].insert(createCnt("foot-cnt"));

				var object = Tokener.parseObject(msg);
				//购物车
				var cars = object.get("car");
				var carit = objArr.itarator();
				var money = 0;
				while(carit.hasNext()){
					var car = carit.next();
					$(".shop_list_cnt")[0].$("ul")[0].insert(createCar(car.get("id"), car.get("img"), car.get("name"), car.get("size"), car.get("quantity"), car.get("price")));
					money += car.get("quantity");
				}
				$(".RMB_NUM")[0].text(money);

				//收藏
				var colles = object.get("colle");
				if(colles.length > 0){
					var collit = objArr.itarator();
					while(collit.hasNext()){
						var coll = collit.next();
						$(".colle-cnt")[0].insert(colleMudle(coll.get("id"), coll.get("img"), coll.get("name"), coll.get("price"), coll.get("time")));
					}
				}

				//足迹
				var foots = object.get("foot");
				if(foots.length > 0){
					var footit = objArr.itarator();
					while(footit.hasNext()){
						var foot = footit.next();
						$(".foot-cnt")[0].insert(createFoot(foot.get("id"), foot.get("img"), foot.get("name")));
					}
				}

				//个人 bar-login
				var person = object.get("infor");
				$(".my-infor-li")[0].insert(createInfor_login(person.get("name"), person.get("integral")));
				//
				$(".loginText")[0].text(person.get("Name")+"，欢迎您。");
			}else if(msg == "false"){
				//无权限
				$(".foot-bt-li")[0].insert(createInfor_no());
				$(".colle-bt-li")[0].insert(createInfor_no());
				$(".my-infor-li")[0].insert(createInfor_no());
			}else alert("数据异常");
		},error:function(){
			alert("初始化异常");
		}
	});
	
	$(".my-cart")[0].onclick = function(){
		if(privili) window.open('用户个人页.html');
		else alert("未登录");
	}
	$(".my-infor")[0].onclick = function(){
		if(privili) window.open('用户个人页.html');
		else alert("未登录");
	}
	$(".my-order")[0].onclick = function(){
		if(privili) window.open('用户个人页.html');
		else alert("未登录");
	}
	$(".register-bt")[0].onclick = function(){
		window.open('memberRegister.html');
	}
	$(".loginText")[0].onclick = function(){
		window.open('memberLogin.html');
	}
	</script>
 </body>
</html>